Skip to content

Use https for dataset download URLs where the host supports TLS - #9631

Draft
fjankovi wants to merge 1 commit into
pytorch:mainfrom
fjankovi:fix/datasets-https-mirrors
Draft

Use https for dataset download URLs where the host supports TLS#9631
fjankovi wants to merge 1 commit into
pytorch:mainfrom
fjankovi:fix/datasets-https-mirrors

Conversation

@fjankovi

Copy link
Copy Markdown

Several dataset classes download over plain http://. Where the host serves the same bytes over TLS, this switches them to https://.

Changed

Dataset Host Verification
Food101 data.vision.ee.ethz.ch 200, full Content-Length
STL10 ai.stanford.edu 200, full Content-Length
SEMEION archive.ics.uci.edu MD5 matches pinned cb545d37…
MovingMNIST www.cs.toronto.edu 200, full Content-Length
Places365 data.csail.mit.edu both devkit MD5s match pinned
KMNIST codh.rois.ac.jp all 4 MD5s match pinned (http already 301'd here)
FashionMNIST S3 all 4 MD5s match pinned

FashionMNIST is not a scheme swap. It pointed at the S3 website endpoint (fashion-mnist.s3-website.eu-central-1.amazonaws.com), which is HTTP-only by design — S3 website endpoints do not support TLS. This points it at the REST endpoint for the same bucket (fashion-mnist.s3.eu-central-1.amazonaws.com), which does.

Every changed URL was fetched over https and checked against the checksum already pinned in the source. The small ones match exactly; the multi-GB archives were confirmed by request rather than downloaded in full.

Deliberately not changed

Three hosts cannot serve https, and rewriting them turns a working download into a hostname-verification failure. A short comment now records why, so the next sweep doesn't complete them:

Host Dataset Why
yann.lecun.com MNIST connections to port 443 are refused — no TLS listener
ufldl.stanford.edu SVHN certificate is valid only for ai.stanford.edu (SAN mismatch)
shuoyang1213.me WIDERFace certificate is for *.github.com (SAN mismatch)

All three remain checksummed. Note MNIST's yann.lecun.com entry is the fallback mirror — https://ossci-datasets.s3.amazonaws.com/mnist/ is tried first — and it now returns 404 for the four resource files regardless of scheme, so test_url_is_accessible[MNIST, …] already fails on main. That's pre-existing and out of scope here; happy to open a separate issue.

LFW, PhotoTour and SUN397 are also left alone: those hosts no longer resolve (vis-www.cs.umass.edu and icvl.ee.ic.ac.uk are NXDOMAIN) or 404 on both schemes. Already tracked in #9580, #8711, #9002 and #9348.

Testing

test/test_datasets_download.py, run against the patched tree:

26 passed  — FashionMNIST 4/4, KMNIST 4/4, SEMEION, STL10, Places365 2/2,
              EMNIST, QMNIST 6/6, SVHN 3/3, WIDERFace 4/4
 4 failed  — MNIST / yann.lecun.com (identical failure on pristine main; see above)

MovingMNIST and Food101 have no fixture in that file, so they were verified by direct request.

No behaviour change beyond the URLs; all checksums are untouched.

Several dataset classes download over plain http. Where the host serves the
same content over TLS, switch to https:

  Food101      data.vision.ee.ethz.ch
  STL10        ai.stanford.edu
  SEMEION      archive.ics.uci.edu
  MovingMNIST  www.cs.toronto.edu
  Places365    data.csail.mit.edu
  KMNIST       codh.rois.ac.jp

FashionMNIST is not a scheme swap: it pointed at the S3 *website* endpoint
(fashion-mnist.s3-website.eu-central-1.amazonaws.com), which serves http only
by design. Point it at the REST endpoint for the same bucket instead
(fashion-mnist.s3.eu-central-1.amazonaws.com), which supports TLS.

Every changed URL was fetched over https and checked against the checksum
already pinned in the source. The four small datasets match exactly
(FashionMNIST 4/4, KMNIST 4/4, SEMEION, Places365 devkits 2/2); the large
archives were confirmed by request.

The remaining http URLs are deliberately left alone, with a comment added
where the reason is not obvious:

  yann.lecun.com        refuses connections on port 443 (and now 404s)
  ufldl.stanford.edu    certificate is valid only for ai.stanford.edu
  shuoyang1213.me       certificate is for *.github.com

Rewriting those would turn a working download into a hostname-verification
failure. LFW, PhotoTour and SUN397 are left untouched as well; those hosts no
longer resolve or 404 on both schemes, which is tracked separately in pytorch#9580,
pytorch#8711, pytorch#9002 and pytorch#9348.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@pytorch-bot

pytorch-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9631

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla

meta-cla Bot commented Aug 26, 2026

Copy link
Copy Markdown

Hi @fjankovi!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant